import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * @author www.javaworkspace.com
 * 
 */
public class JdbcExample {

	public static void main(String[] args) {

		try {
			Class.forName ("oracle.jdbc.OracleDriver");
			  	System.out.println("Connecting to the database...");
			Connection connection = DriverManager.getConnection(
					"jdbc:oracle:thin:@localhost:1521:xe", "system", "mithra97");
			Statement statement = connection.createStatement();
System.out.println("Statement created successfully");
			ResultSet resultset = statement.executeQuery("INSERT INTO provider(pid,pname)VALUES(1,'smith')");
			/*resultset.next();
			String s = resultset.getString(0);
			System.out.println(s);*/
			System.out.println("successfully inserted");
			statement.close();
			connection.close();
		} catch (Exception e) {
			System.out.println("The exception raised is:" + e);
		}
	}

}
